<template>
  <div class="app-container">
    <el-card>
      <el-table v-loading="loading" :data="teamList" @row-dblclick="getConstructionInfo" border>
        <el-table-column label="类别ID" align="center" prop="teamId" />
        <el-table-column label="类别名称" align="center" prop="teamName" :show-overflow-tooltip="true" />
        <el-table-column label="状态" align="center">
          <template slot-scope="scope">
            <el-tag type="danger" v-if="scope.row.teamStatus == 1">禁用</el-tag>
            <el-tag type="success" v-else-if="scope.row.teamStatus == 0">启用</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="所属" align="center">
          <template slot-scope="scope">
            <span>{{scope.row.teamType == "0" ? "施工队" : "租赁服务"}}</span>
          </template>
        </el-table-column>
        <el-table-column label="最后修改时间" align="center" prop="modifiedTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.modifiedTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
    </el-card>
  </div>
</template>

<script>

  import {
    listSuperTeam,
  } from "@/api/super/superTeamSupplier";


  export default {
    name: "Team",
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 分类表格数据
        teamList: null,
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 日期范围
        dateRange: [],
        // 状态数据字典
        statusOptions: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          supplierId : null,
        },
        // 店铺ID
        supplierId: null,
        defaultProps: {
          children: "children",
          label: "label",
        },
      };
    },
    created() {
      let supplierId = parseInt(this.$route.query.supplierId);
      this.getList(supplierId);
      this.supplierId = supplierId;
      this.getDicts("sys_normal_disable").then((response) => {
        this.statusOptions = response.data;
      });

    },
    methods: {
      // 查询分类下的员工信息
      getConstructionInfo(row){
        this.$router.push({path:"/superTeamInfo/teamInfo",query:{teamId:row.teamId}});
      },

      /* 查询类别列表 **/
      getList(supplierId){
        this.loading = true;
        this.queryParams.supplierId = supplierId;
        listSuperTeam(this.queryParams).then(response => {
          this.teamList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
    }
  }
</script>

<style scoped>

</style>
